package main

import (
	"ginweb/dao"
	"ginweb/model"
	"ginweb/routers"
)

func main() {

	//链接数据库
	err := dao.InitMySQL()
	if err != nil {
		panic(err)
	}
	//defer关闭数据库
	defer dao.Close()
	//绑定模型
	dao.DB.AutoMigrate(&model.Todo{})

	//开启gin
	r := routers.SetupRouter()

	r.Run()
}
